package org.jeecg.modules.online.cgform.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.invoke.SerializedLambda;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.enums.CgformEnum;
import org.jeecg.common.exception.TuringBootException;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.online.cgform.consts.OnlineConst;
import org.jeecg.modules.online.cgform.entity.OnlCgformButton;
import org.jeecg.modules.online.cgform.entity.OnlCgformEnhanceJava;
import org.jeecg.modules.online.cgform.entity.OnlCgformEnhanceJs;
import org.jeecg.modules.online.cgform.entity.OnlCgformEnhanceSql;
import org.jeecg.modules.online.cgform.entity.OnlCgformHead;
import org.jeecg.modules.online.cgform.service.IOnlCgformEnhanceService;
import org.jeecg.modules.online.cgform.service.IOnlCgformFieldService;
import org.jeecg.modules.online.cgform.service.IOnlCgformHeadService;
import org.jeecg.modules.online.cgform.utils.CgformUtil;
import org.jeecg.modules.online.cgreport.constant.CgReportConstant;
import org.jeecg.modules.online.config.exception.DBException;
import org.jeecg.modules.online.config.p022d.DbTableUtil;
import org.jeecgframework.codegenerate.database.DbReadTableUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.core.io.ResourceLoader;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping({"/online/cgform/head"})
@RestController("onlCgformHeadController")
public class OnlCgformHeadController {
    @Autowired
    private IOnlCgformHeadService onlCgformHeadService;
    @Autowired
    private IOnlCgformFieldService onlCgformFieldService;
    @Autowired
    private IOnlCgformEnhanceService onlCgformEnhanceService;
    @Autowired
    ResourceLoader resourceLoader;

    /* renamed from: c */
    private static String f151c;

    /* renamed from: a */
    private static final Logger f149a = LoggerFactory.getLogger(OnlCgformHeadController.class);

    /* renamed from: b */
    private static List<String> f150b = null;


    @GetMapping({"/list"})
    public Result<IPage<OnlCgformHead>> m431a(OnlCgformHead onlCgformHead, @RequestParam(name = "pageNo", defaultValue = "1") Integer num, @RequestParam(name = "pageSize", defaultValue = "10") Integer num2, HttpServletRequest httpServletRequest) {
        Result<IPage<OnlCgformHead>> result = new Result<>();
        Wrapper initQueryWrapper = QueryGenerator.initQueryWrapper(onlCgformHead, httpServletRequest.getParameterMap());
        IPage page = this.onlCgformHeadService.page(new Page(num.intValue(), num2.intValue()), initQueryWrapper);
        if (onlCgformHead.getCopyType() != null && onlCgformHead.getCopyType().intValue() == 0) {
            this.onlCgformHeadService.initCopyState(page.getRecords());
        }
        result.setSuccess(true);
        result.setResult(page);
        return result;
    }

    @PostMapping({"/add"})
    @RequiresPermissions({"online:form:add"})
    public Result<OnlCgformHead> m432a(@RequestBody OnlCgformHead onlCgformHead) {
        Result<OnlCgformHead> result = new Result<>();
        try {
            this.onlCgformHeadService.save(onlCgformHead);
            result.success("添加成功！");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            result.error500("操作失败");
        }
        return result;
    }

    @RequiresPermissions({"online:form:edit"})
    @PutMapping({"/edit"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: b */
    public Result<OnlCgformHead> m423b(@RequestBody OnlCgformHead onlCgformHead) {
        Result<OnlCgformHead> result = new Result<>();
        if (((OnlCgformHead) this.onlCgformHeadService.getById(onlCgformHead.getId())) == null) {
            result.error500("未找到对应实体");
        } else if (this.onlCgformHeadService.updateById(onlCgformHead)) {
            result.success("修改成功!");
        }
        return result;
    }

    @DeleteMapping({"/delete"})
    @RequiresPermissions({"online:form:delete"})
    /* renamed from: a */
    public Result<?> m440a(@RequestParam(name = "id", required = true) String str) {
        try {
            this.onlCgformHeadService.deleteRecordAndTable(str);
            return Result.ok("删除成功!");
        } catch (SQLException e) {
            return Result.error("删除失败" + e.getMessage());
        } catch (DBException e2) {
            return Result.error("删除失败" + e2.getMessage());
        }
    }

    @DeleteMapping({"/removeRecord"})
    @RequiresPermissions({"online:form:remove"})
    /* renamed from: b */
    public Result<?> m429b(@RequestParam(name = "id", required = true) String str) {
        try {
            this.onlCgformHeadService.deleteRecord(str);
            return Result.ok("移除成功!");
        } catch (SQLException e) {
            return Result.error("移除失败" + e.getMessage());
        } catch (DBException e2) {
            return Result.error("移除失败" + e2.getMessage());
        }
    }

    @DeleteMapping({"/deleteBatch"})
    @RequiresPermissions({"online:form:deleteBatch"})
    /* renamed from: a */
    public Result<OnlCgformHead> m438a(@RequestParam(name = "ids", required = true) String str, @RequestParam(name = "flag") String str2) {
        Result<OnlCgformHead> result = new Result<>();
        if (str == null || "".equals(str.trim())) {
            result.error500("参数不识别！");
        } else {
            this.onlCgformHeadService.deleteBatch(str, str2);
            if ("1".equals(str2)) {
                result.success("删除成功!");
            } else {
                result.success("移除成功!");
            }
        }
        return result;
    }

    @GetMapping({"/queryById"})
    /* renamed from: c */
    public Result<OnlCgformHead> m422c(@RequestParam(name = "id", required = true) String str) {
        Result<OnlCgformHead> result = new Result<>();
        OnlCgformHead onlCgformHead = (OnlCgformHead) this.onlCgformHeadService.getById(str);
        if (onlCgformHead == null) {
            result.error500("未找到对应实体");
        } else {
            result.setResult(onlCgformHead);
            result.setSuccess(true);
        }
        return result;
    }

    @GetMapping({"/queryByTableNames"})
    /* renamed from: d */
    public Result<?> queryByTableNames(@RequestParam(name = "tableNames", required = true) String str) {
    	LambdaQueryWrapper<OnlCgformHead>  lambdaQueryWrapper = new LambdaQueryWrapper();
    	String[] tableNames = str.split(",");
    	lambdaQueryWrapper.in(OnlCgformHead::getTableName, Arrays.asList(tableNames));
        List list = this.onlCgformHeadService.list(lambdaQueryWrapper);
        if (list == null) {
            return Result.error("未找到对应实体");
        }
        return Result.ok(list);
    }

    @PostMapping({"/enhanceJs/{code}"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: a */
    public Result<?> m435a(@PathVariable("code") String str, @RequestBody OnlCgformEnhanceJs onlCgformEnhanceJs) {
        try {
            onlCgformEnhanceJs.setCgformHeadId(str);
            this.onlCgformHeadService.saveEnhance(onlCgformEnhanceJs);
            return Result.ok("保存成功!");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @GetMapping({"/enhanceJs/{code}"})
    /* renamed from: a */
    public Result<?> m437a(@PathVariable("code") String str, HttpServletRequest httpServletRequest) {
        try {
            OnlCgformEnhanceJs queryEnhance = this.onlCgformHeadService.queryEnhance(str, httpServletRequest.getParameter("type"));
            if (queryEnhance == null) {
                return Result.error("查询为空");
            }
            return Result.ok(queryEnhance);
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("查询失败!");
        }
    }

    @PutMapping({"/enhanceJs/{code}"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: b */
    public Result<?> m425b(@PathVariable("code") String str, @RequestBody OnlCgformEnhanceJs onlCgformEnhanceJs) {
        try {
            onlCgformEnhanceJs.setCgformHeadId(str);
            this.onlCgformHeadService.editEnhance(onlCgformEnhanceJs);
            return Result.ok("保存成功!");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @GetMapping({"/enhanceButton/{formId}"})
    /* renamed from: b */
    public Result<?> m427b(@PathVariable("formId") String str, HttpServletRequest httpServletRequest) {
        try {
            List<OnlCgformButton> queryButtonList = this.onlCgformHeadService.queryButtonList(str);
            if (queryButtonList == null || queryButtonList.size() == 0) {
                return Result.error("查询为空");
            }
            return Result.ok(queryButtonList);
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("查询失败!");
        }
    }

    @GetMapping({"/enhanceSql/{formId}"})
    /* renamed from: c */
    public Result<?> m421c(@PathVariable("formId") String str, HttpServletRequest httpServletRequest) {
        return Result.OK(this.onlCgformEnhanceService.queryEnhanceSqlList(str));
    }

    @PostMapping({"/enhanceSql/{formId}"})
    @RequiresPermissions({"online:form:enhanceSql:save"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: a */
    public Result<?> m434a(@PathVariable("formId") String str, @RequestBody OnlCgformEnhanceSql onlCgformEnhanceSql) {
        try {
            onlCgformEnhanceSql.setCgformHeadId(str);
            if (this.onlCgformEnhanceService.checkOnlyEnhance(onlCgformEnhanceSql)) {
                this.onlCgformEnhanceService.saveEnhanceSql(onlCgformEnhanceSql);
                return Result.ok("保存成功!");
            }
            return Result.error("保存失败,该按钮已存在增强配置!");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @RequiresPermissions({"online:form:enhanceSql:edit"})
    @PutMapping({"/enhanceSql/{formId}"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: b */
    public Result<?> enhanceSql(@PathVariable("formId") String str, @RequestBody OnlCgformEnhanceSql onlCgformEnhanceSql) {
        try {
            onlCgformEnhanceSql.setCgformHeadId(str);
            if (this.onlCgformEnhanceService.checkOnlyEnhance(onlCgformEnhanceSql)) {
                this.onlCgformEnhanceService.updateEnhanceSql(onlCgformEnhanceSql);
                return Result.ok("保存成功!");
            }
            return Result.error("保存失败,该按钮已存在增强配置!");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @DeleteMapping({"/enhanceSql"})
    @RequiresPermissions({"online:form:enhanceSql:delete"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: e */
    public Result<?> m417e(@RequestParam(name = "id", required = true) String str) {
        try {
            this.onlCgformEnhanceService.deleteEnhanceSql(str);
            return Result.ok("删除成功");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("删除失败!");
        }
    }

    @DeleteMapping({"/deletebatchEnhanceSql"})
    @RequiresPermissions({"online:form:enhanceSql:batchDelete"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: f */
    public Result<?> m416f(@RequestParam(name = "ids", required = true) String str) {
        try {
            this.onlCgformEnhanceService.deleteBatchEnhanceSql(Arrays.asList(str.split(CgformUtil.f233E)));
            return Result.ok("删除成功");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("删除失败!");
        }
    }

    @GetMapping({"/enhanceJava/{formId}"})
    /* renamed from: a */
    public Result<?> m436a(@PathVariable("formId") String str, OnlCgformEnhanceJava onlCgformEnhanceJava) {
        return Result.OK(this.onlCgformEnhanceService.queryEnhanceJavaList(str));
    }

    @PostMapping({"/enhanceJava/{formId}"})
    @RequiresPermissions({"online:form:enhanceJava:save"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: b */
    public Result<?> m426b(@PathVariable("formId") String str, @RequestBody OnlCgformEnhanceJava onlCgformEnhanceJava) {
        try {
            if ("1".equals(onlCgformEnhanceJava.getActiveStatus()) && !CgformUtil.m356a(onlCgformEnhanceJava)) {
                return Result.error("类实例化失败，请检查!");
            }
            onlCgformEnhanceJava.setCgformHeadId(str);
            String buttonCode = onlCgformEnhanceJava.getButtonCode();
            if ("import".equals(buttonCode) || "export".equals(buttonCode) || "query".equals(buttonCode)) {
                onlCgformEnhanceJava.setEvent(CgformUtil.f274at);
            }
            if (this.onlCgformEnhanceService.checkOnlyEnhance(onlCgformEnhanceJava)) {
                this.onlCgformEnhanceService.saveEnhanceJava(onlCgformEnhanceJava);
                return Result.ok("保存成功!");
            }
            return Result.error("保存失败：一个按钮、事件只能有一个增强！");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @RequiresPermissions({"online:form:enhanceJava:edit"})
    @PutMapping({"/enhanceJava/{formId}"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: c */
    public Result<?> m420c(@PathVariable("formId") String str, @RequestBody OnlCgformEnhanceJava onlCgformEnhanceJava) {
        try {
            if ("1".equals(onlCgformEnhanceJava.getActiveStatus()) && !CgformUtil.m356a(onlCgformEnhanceJava)) {
                return Result.error("类实例化失败，请检查!");
            }
            onlCgformEnhanceJava.setCgformHeadId(str);
            String buttonCode = onlCgformEnhanceJava.getButtonCode();
            if ("import".equals(buttonCode) || "export".equals(buttonCode) || "query".equals(buttonCode)) {
                onlCgformEnhanceJava.setEvent(CgformUtil.f274at);
            }
            if (this.onlCgformEnhanceService.checkOnlyEnhance(onlCgformEnhanceJava)) {
                this.onlCgformEnhanceService.updateEnhanceJava(onlCgformEnhanceJava);
                return Result.ok("保存成功!");
            }
            return Result.error("保存失败：一个按钮、事件只能有一个增强！");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("保存失败!");
        }
    }

    @DeleteMapping({"/enhanceJava"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: g */
    public Result<?> m415g(@RequestParam(name = "id", required = true) String str) {
        try {
            this.onlCgformEnhanceService.deleteEnhanceJava(str);
            return Result.ok("删除成功");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("删除失败!");
        }
    }

    @DeleteMapping({"/deleteBatchEnhanceJava"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    /* renamed from: h */
    public Result<?> m414h(@RequestParam(name = "ids", required = true) String str) {
        try {
            this.onlCgformEnhanceService.deleteBatchEnhanceJava(Arrays.asList(str.split(CgformUtil.f233E)));
            return Result.ok("删除成功");
        } catch (Exception e) {
            f149a.error(e.getMessage(), e);
            return Result.error("删除失败!");
        }
    }

    @RequiresPermissions({"online:form:queryTables"})
    @GetMapping({"/queryTables"})
    /* renamed from: a */
    public Result<?> m439a(@RequestParam(name = "tableName", required = false) String str, @RequestParam(name = "pageNo", defaultValue = "1") Integer num, @RequestParam(name = "pageSize", defaultValue = "10") Integer num2, HttpServletRequest httpServletRequest) {
        JwtUtil.getUserNameByToken(httpServletRequest);
        new ArrayList();
        try {
            List readAllTableNames = DbReadTableUtil.readAllTableNames();
            CgformUtil.m339b(readAllTableNames);
            List<String> m315f = CgformUtil.m315f(readAllTableNames);
            List<String> queryOnlinetables = this.onlCgformHeadService.queryOnlinetables();
            //m430b();
            m315f.removeAll(queryOnlinetables);
            ArrayList arrayList = new ArrayList();
            for (String str2 : m315f) {
            	 HashMap hashMap = new HashMap(5);
                 hashMap.put("id", str2);
                 arrayList.add(hashMap);
            }
            return Result.ok(arrayList);
        } catch (SQLException e) {
            f149a.error(e.getMessage(), e);
            return Result.error("同步失败，未获取数据库表信息");
        }
    }

    @PostMapping({"/transTables/{tbnames}"})
    @RequiresPermissions({"online:form:importTable"})
    /* renamed from: d */
    public Result<?> transTables(@PathVariable("tbnames") String str, HttpServletRequest httpServletRequest) {
        String[] split;
        if (!"admin".equals(JwtUtil.getUserNameByToken(httpServletRequest))) {
            return Result.error("noadminauth");
        }
        if (oConvertUtils.isEmpty(str)) {
            return Result.error("未识别的表名信息");
        }
        if (f151c != null && f151c.equals(str)) {
            return Result.error("不允许重复生成!");
        }
        f151c = str;
        StringBuilder sb = new StringBuilder();
        boolean z = false;
        for (String str2 : str.split(CgformUtil.f233E)) {
        	LambdaQueryWrapper<OnlCgformHead>  lambdaQueryWrapper = new LambdaQueryWrapper();
        	lambdaQueryWrapper.eq(OnlCgformHead::getTableName, str2);
            if (oConvertUtils.isNotEmpty(str2) && Long.valueOf(this.onlCgformHeadService.count(lambdaQueryWrapper)).longValue() <= 0) {
                f149a.info("[IP] [online数据库导入表]   --表名：" + str2);
                try {
                    this.onlCgformHeadService.saveDbTable2Online(str2);
                    sb.append("表[").append(str2).append("]导入成功。<br>");
                } catch (Exception e) {
                    z = true;
                    sb.append("表[").append(str2).append("]导入失败：").append(e.getMessage()).append("<br>");
                }
            }
        }
        f151c = null;
        if (z) {
            return Result.error("导入完成，但有错误：<br>" + ((Object) sb));
        }
        return Result.ok("全部导入完成！");
    }

    @RequiresPermissions({"online:codeGenerate:projectPath"})
    @GetMapping({"/rootFile"})
    /* renamed from: a */
    public Result<?> m441a() {
        File[] listRoots;
        JSONArray jSONArray = new JSONArray();
        for (File file : File.listRoots()) {
            JSONObject jSONObject = new JSONObject();
            if (file.isDirectory()) {
                jSONObject.put("key", file.getAbsolutePath());
                jSONObject.put(CgformUtil.f298aR, file.getPath());
                jSONObject.put("opened", false);
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("icon", "custom");
                jSONObject.put("scopedSlots", jSONObject2);
                jSONObject.put("isLeaf", Boolean.valueOf(file.listFiles() == null || file.listFiles().length == 0));
                jSONArray.add(jSONObject);
            }
        }
        return Result.ok(jSONArray);
    }

    @RequiresPermissions({"online:codeGenerate:projectPath"})
    @GetMapping({"/fileTree"})
    /* renamed from: i */
    public Result<?> m413i(@RequestParam(name = "parentPath", required = true) String str) {
        File[] listFiles;
        JSONArray jSONArray = new JSONArray();
        for (File file : new File(str).listFiles()) {
            if (file.isDirectory() && !file.isHidden() && oConvertUtils.isNotEmpty(file.getPath())) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("key", file.getAbsolutePath());
                jSONObject.put(CgformUtil.f298aR, file.getPath().substring(file.getPath().lastIndexOf(File.separator) + 1));
                jSONObject.put("isLeaf", Boolean.valueOf(file.listFiles() == null || file.listFiles().length == 0));
                jSONObject.put("opened", false);
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("icon", "custom");
                jSONObject.put("scopedSlots", jSONObject2);
                jSONArray.add(jSONObject);
            }
        }
        return Result.ok(jSONArray);
    }

    @GetMapping({"/tableInfo"})
    /* renamed from: j */
    public Result<?> m412j(@RequestParam(name = "code", required = true) String str) {
        String[] split;
        OnlCgformHead onlCgformHead = (OnlCgformHead) this.onlCgformHeadService.getById(str);
        if (onlCgformHead == null) {
            return Result.error("未找到对应实体");
        }
        HashMap hashMap = new HashMap(5);
        hashMap.put(CgReportConstant.f469a, onlCgformHead);
        if (onlCgformHead.getTableType().intValue() == 2) {
            String subTableStr = onlCgformHead.getSubTableStr();
            if (oConvertUtils.isNotEmpty(subTableStr)) {
                ArrayList arrayList = new ArrayList();
                for (String str2 : subTableStr.split(CgformUtil.f233E)) {
                	LambdaQueryWrapper<OnlCgformHead> lambdaQueryWrapper = new LambdaQueryWrapper();
                    lambdaQueryWrapper.eq(OnlCgformHead::getTableName, str2);
                    arrayList.add(this.onlCgformHeadService.getOne(lambdaQueryWrapper));
                }
                Collections.sort(arrayList, new Comparator<OnlCgformHead>() { // from class: org.jeecg.modules.online.cgform.c.d.1
                    @Override // java.util.Comparator
                    /* renamed from: a */
                    public int compare(OnlCgformHead onlCgformHead2, OnlCgformHead onlCgformHead3) {
                        Integer tabOrderNum = onlCgformHead2.getTabOrderNum();
                        if (tabOrderNum == null) {
                            tabOrderNum = 0;
                        }
                        Integer tabOrderNum2 = onlCgformHead3.getTabOrderNum();
                        if (tabOrderNum2 == null) {
                            tabOrderNum2 = 0;
                        }
                        return tabOrderNum.compareTo(tabOrderNum2);
                    }
                });
                hashMap.put("sub", arrayList);
            }
        }
        Integer tableType = onlCgformHead.getTableType();
        if ("Y".equals(onlCgformHead.getIsTree())) {
            tableType = 3;
        }
        hashMap.put("jspModeList", CgformEnum.getJspModelList(tableType.intValue()));
        hashMap.put("projectPath", DbReadTableUtil.getProjectPath());
        return Result.ok(hashMap);
    }

    @PostMapping({"/copyOnline"})
    /* renamed from: k */
    public Result<?> copyOnline(@RequestParam(name = "code", required = true) String str) {
        OnlCgformHead onlCgformHead = null;
        try {
            onlCgformHead = this.onlCgformHeadService.getById(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (onlCgformHead == null) {
            return Result.error("未找到对应实体");
        }
        try {
			this.onlCgformHeadService.copyOnlineTableConfig(onlCgformHead);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return Result.ok();
    }

    @GetMapping({"/copyOnlineTable/{id}"})
    /* renamed from: b */
    public Result<?> copyOnlineTableById(@PathVariable("id") String str, @RequestParam(name = "tableName") String str2) {
        try {
            this.onlCgformHeadService.copyOnlineTable(str, str2);
            return Result.ok();
        } catch (TuringBootException e) {
            return Result.error(e.getMessage());
        } catch (Exception e2) {
            f149a.error(e2.getMessage(), e2);
            return Result.error(e2.getMessage());
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0018  */
    /* renamed from: l */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
//    private boolean m410l(java.lang.String r4) {
//        /*
//            r3 = this;
//            java.util.List<java.lang.String> r0 = org.jeecg.modules.online.cgform.p009c.OnlCgformHeadController.f150b
//            if (r0 == 0) goto L3a
//            java.util.List<java.lang.String> r0 = org.jeecg.modules.online.cgform.p009c.OnlCgformHeadController.f150b
//            java.util.Iterator r0 = r0.iterator()
//            r5 = r0
//        Lf:
//            r0 = r5
//            boolean r0 = r0.hasNext()
//            if (r0 == 0) goto L3a
//            r0 = r5
//            java.lang.Object r0 = r0.next()
//            java.lang.String r0 = (java.lang.String) r0
//            r6 = r0
//            r0 = r4
//            r1 = r6
//            boolean r0 = r0.startsWith(r1)
//            if (r0 != 0) goto L35
//            r0 = r4
//            r1 = r6
//            java.lang.String r1 = r1.toUpperCase()
//            boolean r0 = r0.startsWith(r1)
//            if (r0 == 0) goto L37
//        L35:
//            r0 = 1
//            return r0
//        L37:
//            goto Lf
//        L3a:
//            r0 = 0
//            return r0
//        */
//        throw new UnsupportedOperationException("Method not decompiled: org.jeecg.modules.online.cgform.p009c.OnlCgformHeadController.m410l(java.lang.String):boolean");
//    }

    /* renamed from: b */
//    private void m430b() {
//        String string;
//        if (f150b == null) {
//            ResourceBundle m26d = DbTableUtil.m26d(OnlineConst.f142d);
//            if (m26d != null && m26d.containsKey("exclude_table") && (string = m26d.getString("exclude_table")) != null) {
//                f150b = Arrays.asList(string.split(CgformUtil.f233E));
//                return;
//            }
//            InputStream inputStream = null;
//            try {
//                try {
//                    inputStream = this.resourceLoader.getResource("classpath:jeecg" + File.separator + "jeecg_config.properties").getInputStream();
//                    Properties properties = new Properties();
//                    properties.load(inputStream);
//                    String property = properties.getProperty("exclude_table");
//                    if (property != null) {
//                        f150b = Arrays.asList(property.split(CgformUtil.f233E));
//                    }
//                    if (inputStream != null) {
//                        try {
//                            inputStream.close();
//                        } catch (IOException e) {
//                            e.printStackTrace();
//                        }
//                    }
//                } catch (IOException e2) {
//                    e2.printStackTrace();
//                    if (inputStream != null) {
//                        try {
//                            inputStream.close();
//                        } catch (IOException e3) {
//                            e3.printStackTrace();
//                        }
//                    }
//                }
//            } catch (Throwable th) {
//                if (inputStream != null) {
//                    try {
//                        inputStream.close();
//                    } catch (IOException e4) {
//                        e4.printStackTrace();
//                    }
//                }
//                throw th;
//            }
//        }
//    }
}
